package com.hyh.fireworks.common.utils;

import cn.hutool.core.util.StrUtil;

/**
 * 文件相关工具类
 *
 * @author Summerday
 */
public class FileUtil extends cn.hutool.core.io.FileUtil {


    public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+";


    public static boolean isValidName(String fileName) {
        return StrUtil.isNotBlank(fileName) && fileName.matches(FILENAME_PATTERN);
    }


    public static void main(String[] args) {
        String filename1 = "";
        String filename3 = "    ";
        String filename4 = "jdeujdej";
        String filename5 = "<.jpg";


        System.out.println(FileUtil.isValidName(filename1));
        System.out.println(FileUtil.isValidName(filename3));
        System.out.println(FileUtil.isValidName(filename4));
        System.out.println(FileUtil.isValidName(filename5));

    }

}
